package com.lu.bussiness.quartz;

import org.quartz.*;

import java.text.SimpleDateFormat;

public class FirstJob implements Job {

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        System.out.println("定时任务");
        System.out.println("==========================");
        JobDetail jobDetail = context.getJobDetail();
        JobKey jobKey = jobDetail.getKey();
        System.out.println("任务名称："+jobKey.getName()+"，任务组："+jobKey.getGroup());
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYY-MM-DD hh:mm:ss");
        System.out.println(simpleDateFormat.format(context.getNextFireTime()));
        Trigger trigger = context.getTrigger();
        TriggerKey triggerKey =  trigger.getKey();
        System.out.println("触发任务名称："+triggerKey.getName()+"，触发任务组："+triggerKey.getGroup());

    }
}
